package com.cuitrip.business.tripservice;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.cuitrip.business.home.IndexActivity;
import com.cuitrip.business.login.LoginInstance;
import com.cuitrip.business.user.PersonActivity;
import com.cuitrip.business.user.model.CtUserInfo;
import com.cuitrip.service.R;
import com.lab.app.BaseActivity;
import com.lab.utils.ImageHelper;

import butterknife.ButterKnife;
import butterknife.Bind;
import butterknife.OnClick;
import de.hdodenhof.circleimageview.CircleImageView;

/**
 * Created on 7/28.
 */
public class CreateServiceSuccessActivity extends BaseActivity {


    @Bind(R.id.complete_info_guide)
    protected LinearLayout completeInfoView;

    @Bind(R.id.submit_action)
    TextView submitAction;

    @Bind(R.id.author_img)
    CircleImageView authorImg;

    @Bind(R.id.return_action)
    View returnAction;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ct_create_service_sucess);
        ButterKnife.bind(this);
        initData();
    }

    @OnClick(R.id.return_action)
    public void returnTripList(){
        IndexActivity.gotoTab(this, IndexActivity.SERVICE_TAB_INDEX);
        finish();
    }

    private void initData(){
//        if (isUserInfoComplete()){
            completeInfoView.setVisibility(View.GONE);
            returnAction.setVisibility(View.VISIBLE);
            submitAction.setVisibility(View.GONE);
//        }else{
//            completeInfoView.setVisibility(View.VISIBLE);
//            returnAction.setVisibility(View.GONE);
//            submitAction.setVisibility(View.VISIBLE);
//            submitAction.setText(R.string.sign_up_update_user_profile);
//            submitAction.setOnClickListener(new View.OnClickListener() {
//                @Override
//                public void onClick(View v) {
//                    PersonActivity.jumpPersonActivity(CreateServiceSuccessActivity.this, null, LoginInstance.getInstance().getUserInfo().getUid());
//                    finish();
//                }
//            });
//            ImageHelper.displayPersonImage(LoginInstance.getInstance().getUserInfo().getHeadPic(),authorImg,null);
//        }
    }

    private boolean isUserInfoComplete(){
        CtUserInfo userInfo = LoginInstance.getInstance().getUserInfo();
        if (userInfo == null){
            return false;
        }
        if (TextUtils.isEmpty(userInfo.getNick()) || TextUtils.isEmpty(userInfo.getCareer())||
                TextUtils.isEmpty(userInfo.getInterests())|| TextUtils.isEmpty(userInfo.getLanguage())||
                TextUtils.isEmpty(userInfo.getMobile())|| TextUtils.isEmpty(userInfo.getEmail())||
                TextUtils.isEmpty(userInfo.getIdNumber())){
            return false;
        }

        return true;

    }
}
